﻿using Microsoft.AspNetCore.Mvc;
using MVC_System.DTO;
using MVC_System.DTO.ProcurementAndStorageDTO;
using WMS_MAV;
using static System.Net.WebRequestMethods;

namespace MVC_System.Controllers
{
    /// <summary>
    /// 采购入库
    /// </summary>
    public class ProcurementAndStorageController : Controller
    {

        protected readonly IConfiguration _configuration;

        public ProcurementAndStorageController(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        /// <summary>
        /// 采购入库信息添加
        /// </summary>
        /// <returns></returns>
        public IActionResult PASaDD()
        {
            return View();
        }

        /// <summary>
        /// 采购入库显示
        /// </summary>
        /// <returns></returns>
        public IActionResult PASshow()
        {
            return View();
        }

        /// <summary>
        /// 采购入库显示
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task<ActionResult> LedgerInfoPASshow(PASshowDTO dto)
        {
            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "LYH/api/ProcurementAndStorage/ProcurementAndStorageShow?pageIndex=" + dto.pageIndex + "&pageSize="+ dto.pageSize + "&ProcuredNumber="+ dto.ProcuredNumber + "&AddTime="+ dto.AddTime + "&Status="+ dto.Status;
            var respomse = await client.GetAsync(url);

            return Json(respomse);
        }



        /// <summary>
        /// 采购入库详情
        /// </summary>
        /// <returns></returns>
        public IActionResult PASparticulars()
        {
            return View();
        }

        /// <summary>
        /// 根据仓库名称擦寻信息2
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public async Task<ActionResult> LedgerInfoWarehouseNameList(WarehouseNameListDTO dto)
        {
            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "mhb/api/Warehouse/WarehouseNameList?warehouseName=" + dto.warehouseName;
            var respomse = await client.GetAsync(url);

            return Json(respomse);
        }


    }
}
